<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mon Site</title>
 
<script type="text/javascript" src="css/clientajax.js"></script>
<script type="text/javascript" src="css/jquery.js"></script>
<script type="text/javascript" src="css/jquery.dimensions.js"></script>
<script type="text/javascript">
function begin(){
	var $left = $("#imgtop").offset().left + document.getElementById("imgtop").offsetWidth - 400;
	var $top = $("#imgtop").offset().top + document.getElementById("imgtop").offsetHeight - 30;
	$("#googlesearch").css("left", $left + "px");
	$("#googlesearch").css("top", $top + "px");
}
function calcTaxe(){
	var $tps = 0.05;
	var $tvq = 0.09975;
	var $mnt = $("#mnt").val();
	if(!isNaN($mnt)){
		var $mntTaxe = parseFloat($mnt) + parseFloat($tps * $mnt) + parseFloat($tvq * $mnt);
		$("#tps").val($tps * $mnt);
		$("#mntTaxe").val($mntTaxe);
		$("#tvq").val($tvq * $mnt);
	}
}
</script>
<script type="text/javascript">
	$(document).ready(function() { 
		$(window).bind("resize", function(){ 
			var $left = $("#imgtop").offset().left + document.getElementById("imgtop").offsetWidth - 400;
			var $top = $("#imgtop").offset().top + document.getElementById("imgtop").offsetHeight - 30;
			$("#googlesearch").css("left", $left + "px");
			$("#googlesearch").css("top", $top + "px");
			$("#taxe").css("left", $left + "px");
			$("#taxe").css("top", ($top + 20) + "px");
		 });
	}); 
</script>
</head>
<link rel="stylesheet" type="text/css" href="css/csshome.css" />
<body background="images/body_bg.jpg" onload="begin();">
<div align="center"><img src="images/top1.gif" id="imgtop" name="imgtop"/>
<form id="googlesearch" name="googlesearch" method="get" action="http://www.google.ca/search" target="_blank" style="position:absolute; width: 290;">
		<input type="text" name="q" size="31" maxlength="255" value="" />
		<input type="submit" value="Google Search"  />
</form>
<table id="taxe" border="0" style="position:absolute; width: 290;">
<tr><td>Montant avant taxe</td><td><input type="text" id="mnt" name="mnt" onkeyup="calcTaxe();" /></td></tr>
<tr><td>TPS (5%)</td><td><input type="text" id="tps" name="tps" readonly /></td></tr>
<tr><td>TVQ (9.975%)</td><td><input type="text" id="tvq" name="tvq" readonly /></td></tr>
<tr><td>Montant avec taxe</td><td><input type="text" id="mntTaxe" name="mntTaxe" readonly /></td></tr>
</table>
</div><div id="Mydiv">
 <?php
include 'php/siteclass.php';
include 'php/accent.php';
include 'php/infobd.php';
$requete = "select nom, lien, site.categorie, site.cote, categorie.cote from site left join categorie on site.categorie = categorie.cat order by categorie.cote, site.cote;";

$con = mysql_connect($serv,$user,$passw);
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}
mysql_select_db($db, $con);
$result = mysql_query($requete);

$cats = new Categories();
while($row = mysql_fetch_array($result))
{
	$s = new Site(str_replace($dbaccent, $codeaccent, $row['nom']), str_replace($dbaccent, $codeaccent, $row['lien']), str_replace($dbaccent, $codeaccent, $row['categorie']));
	$cats->__add($s);
}

mysql_close($con);

$indexcol = 0;

echo "<table id='tb' border='0' width='900'><tr>";

//foreach ($cats->__get($tb) as $cat){
foreach ($cats->tb as $cat){
	if($indexcol == 0 || $indexcol == 2 || $indexcol == 6){
		echo "<td width='300'>";
	}
	
	echo $cat->__tostring();
	
	if($indexcol == 1 || $indexcol == 5){
		echo "</td>";
	}
	$indexcol++;
}

echo "</tr></table>";
?>
</div>
<div align="center"><img src="images/down.gif"/></div>
 
</body>
</html>